package com.company.project.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.company.project.pojo.institution.Institution;
import com.company.project.mapper.InstitutionMapper;
import com.company.project.pojo.institution.InstitutionDTO;
import com.company.project.service.IInstitutionService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 单位 服务实现类
 * </p>
 *
 * @author 任建波
 * @since 2019-08-09
 */
@Service
public class InstitutionServiceImpl extends ServiceImpl<InstitutionMapper, Institution> implements IInstitutionService {

    @Autowired
    private InstitutionMapper institutionMapper;

    /**
     * 获取单位列表
     */
    @Override
    public IPage<InstitutionDTO> getInstitutionListPage(Page page, Integer contradictionId) {
        IPage pageInfo = institutionMapper.getInstitutionList(page, contradictionId);
        return pageInfo;
    }

    /**
     *根据角色获取单位列表
     */
    @Override
    public List<InstitutionDTO> getInstitutionListByRoleId(Integer role_id) {
        List<InstitutionDTO> institutionDTOList = institutionMapper.getInstitutionListByRoleId(role_id);
        return institutionDTOList;
    }

    /**
     * 根据类型获取单位列表
     */
    @Override
    public List<InstitutionDTO> getInstitutionListByType(Integer type) {
        List<InstitutionDTO> institutionDTOList = institutionMapper.getInstitutionListByType(type);

        return institutionDTOList;
    }

}
